#include "mystdio.h"
#include "mystring.h"
#include <string.h>
#include <unistd.h>

int main()
{
    MyFile *filep = MyFopen("./log.txt", "a");
    if(!filep)
    {
        printf("fopen error!\n");
        return 1;
    }

    int cnt = 10;
    while(cnt--)
    {
        char *msg = (char*)"hello myfile!!!";
        Mywrite(filep, msg, strlen(msg));
        MyFFlush(filep);
        printf("buffer: %s\n", filep->_outbuffer);
        sleep(1);
    }
    Myclose(filep); // FILE *fp

    const char *str = "hello bit!\n";
    printf("strlen: %ld\n",strlen(str));
    return 0;
}
